<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String token_forget = java.util.UUID.randomUUID().toString();
String token_lost = java.util.UUID.randomUUID().toString();
session.setAttribute("token_forget", token_forget);
session.setAttribute("token", token_lost);
%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" href="jquery/css/smoothness/jquery-ui-1.8.20.custom.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="jquery/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="jquery/themes/icon.css">
<script type="text/javascript" src="jquery/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="jquery/js/jquery-ui-1.8.20.custom.min.js"></script>

<link rel="stylesheet" type="text/css" href="css/myp.css">
<link rel="stylesheet" type="text/css" href="css/mylayout.css">
<link rel="stylesheet" type="text/css" href="css/myul.css">
<link rel="stylesheet" type="text/css" href="css/myil.css">
<link rel="stylesheet" type="text/css" href="css/mya.css">
<link rel="stylesheet" type="text/css" href="css/mydiv.css">
<title>找回账号</title>

<script>
$(function(){
	var aforget_text = '忘记密码';
	var alost_text = '丢失激活码';	
	var pforget_isshow = false;
	var plost_isshow = false;
	
	$('#aforget').text(aforget_text);
	$('#alost').text(alost_text);
	$('#pforget').hide();
	$('#plost').hide();
	
	$('#aforget').click(function(){
		if (pforget_isshow==true){
			$('#pforget').hide();
			$('#aforget').text(aforget_text);
			pforget_isshow = false;		
		} else {
			pforget_isshow = true;
			$('#aforget').text(aforget_text + ' ↓');
			$('#pforget').show();			
		}		
		$('#plost').hide();	
		plost_isshow = false;
		$('#alost').text(alost_text);
	});
	
	$('#alost').click(function(){
		if (plost_isshow==true){
			$('#plost').hide();
			$('#alost').text(alost_text);
			plost_isshow = false;		
		} else {
			plost_isshow = true;
			$('#plost').show();
			$('#alost').text(alost_text + ' ↓');			
		}		
		$('#pforget').hide();
		pforget_isshow = false;
		$('#aforget').text(aforget_text);
	});	
		
	var pforget_tip_can = false;
	$('#pforget_tip').hide();
	
	$('#tforget_id').change(function(){
		var s = $('#tforget_id').val();
		$.post('User_checkAccount?uvo.id='+s,function(result){		
			if (result!=""){									
				$('#pforget_tip').html("<font size='3' color='#66CDAA'>您好, \""+ result +"\" ! Coding将帮你找到您的账户</font>");											
				pforget_tip_can = true;
			}else {
				$('#pforget_tip').html("<font size='3' color='red'>用户不存在</font>");				
				pforget_tip_can = false;
			}
			$('#pforget_tip').show();
		});				
	});
	
	var plost_tip_can = false;
	$('#plost_tip').hide();
	
	$('#tlost_id').change(function(){
		var s = $('#tlost_id').val();
		$.post('User_checkAccount?uvo.id='+s,function(result){
			if (result!=""){		
				$('#plost_tip').html("<font size='3' color='#66CDAA'>您好, \""+ result +"\" ! Coding将帮你找到您的账户</font>");							
				plost_tip_can= true;
			}else {
				$('#plost_tip').html("<font size='3' color='red'>用户不存在</font>");
				plost_tip_can = false;
			}
			$('#plost_tip').show();
		});				
	});
	
	$('bforget').click(function(){
		$('#fforget').submit();
	});
	
	$('#fforget').submit(function(event){
		if ($('#tforget_id').val().length==0){						
			$('#tforget_id').focus();
			event.preventDefault();//此处阻止提交表单
			//alert('请输入您账户的邮箱！'); 
		}else if (pforget_tip_can == false){
			//alert('您的用户的邮箱不存在！');
			$('#tforget_id').focus();
			event.preventDefault();//此处阻止提交表单						
		} else
			alert('已经发送到您的邮箱，请查收');
	});
	
	$('blost').click(function(){
		$('#flost').submit();
	});
	
	$('#flost').submit(function(event){
		if ($('#tlost_id').val().length==0){						
			$('#tlost_id').focus();
			event.preventDefault();//此处阻止提交表单
			//alert('请输入您账户的邮箱！'); 
		}else if (plost_tip_can == false){
			alert('您的用户的邮箱不存在！');
			$('#tlost_id').focus();
			//event.preventDefault();//此处阻止提交表单						
		} else
			alert('已经发送到您的邮箱，请查收');
	});	
});


</script>

</head>
<body style="background:#F0FFF0;">
<br /><br /><br /><br /><br />
<center>
<div class="alpha" style="background:#FFFFFF;padding:0px;width:40%;height:100%;">

		<p class="ridge">Coding帮您找回账号</p>
		<ul>
		<li><a class="myitem" id="aforget" href="#">忘记密码</a></li>
		<li><a class="myitem" id="alost" href="#">丢失激活码</a></li>
		</ul>
		<div id="pforget" class="easyui-panel" style="width:500px;height:200px;padding:10px;background:#F0FFF0;">
			<form id="fforget" action="User_sendPassword" method="post" target="blankFrame" >
				<input type="hidden" name="token" value="<%= token_forget%>"/>			
				<input id="tforget_id" type="text" placeholder="邮箱名" name="u.U_EMAIL" />			
				<div id="pforget_tip" class="easyui-panel" border="0">				
				</div>			
				<button id="bforget" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
							<span class="ui-button-text">发送随机密码到您邮箱</span></button>			
			</form>
		</div>
		<div id="plost" class="easyui-panel" style="width:500px;height:200px;padding:10px;background:#F0FFF0;">
			<form id="flost" action="UserActivate_reSend" method="post" target="blankFrame">
				<input type="hidden" name="token" value="<%= token_lost%>"/>
				<input id="tlost_id" type="text" placeholder="邮箱名" name="email"/>
				<div id="plost_tip" class="easyui-panel" border="0">				
				</div>
				
				<button id="blost" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
							<span class="ui-button-text">再次激活账户</span></button>			
			</form>
		</div>		
	

<!-- 以上为寻找密码部分 -->
	
</div>
</center>

<!-- 对话框 -->
<iframe src="about:blank" name="blankFrame" id="blankFrame" style="display: none;"></iframe>
<!--<div id="d2" class="easyui-dialog" title="Another Dialog" 
	style="width:400px;height:200px;left:100px;top:150px;padding:10px" 
	resizable="false">
		Dialog toolbar and buttons are created from existing HTML nodes.
</div>

--></body>
</html>